package org.jsola.hr.web;

import lombok.extern.slf4j.Slf4j;
import org.jsola.core.Page;
import org.jsola.core.Result;
import org.jsola.hr.constant.HrConstants;
import org.jsola.hr.service.IHrLoginLogService;
import org.jsola.user.core.TokenUser;
import org.jsola.user.core.UserContext;
import org.jsola.user.query.LoginLogQuery;
import org.jsola.user.vo.LoginLogListVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;


/**
 * @author zhenghua
 */
@Slf4j
@RestController("hrLoginLogController")
@RequestMapping(HrConstants.API_PATH + "/v1/login")
public class HrLoginLogController implements IHrLoginLogControllerAPI {

    @Autowired
    private IHrLoginLogService hrLoginLogService;

    @Override
    @GetMapping("pageNotSiteId")
    public Result<Page<LoginLogListVO>> pageNotSiteId(@Valid LoginLogQuery loginLogQuery) {
        TokenUser tokenUser = UserContext.getUser();
        // todo 查看项目权限校验

        return Result.success(
                hrLoginLogService.pageNotSiteId(loginLogQuery)
        );
    }

}
